//
//  KATRadioButton.h
//  KATFramework
//
//  Created by Kantice on 14-6-24.
//  Copyright (c) 2014年 KatApp. All rights reserved.
//  单选按钮（分段选择器）

#import <UIKit/UIKit.h>

#import "KATArray.h"
#import "KATColor.h"
#import "KATButton.h"
#import "KATRadioButtonItem.h"
#import "KATSprite.h"



@class KATRadioButton;

@protocol KATRadioButtonDelegate <NSObject>

@required

///更改选中标签
- (void)radioButton:(KATRadioButton *)button didChangedSelectedItem:(KATRadioButtonItem *)item;

@end


@interface KATRadioButton : KATSprite


#pragma -mark 属性


///项目个数
@property(nonatomic,readonly) int itemCount;

///选中的项目
@property(nonatomic,assign) int selectedIndex;

///上一次选择的索引
@property(nonatomic,assign) int lastIndex;

///选中的项目
@property(nonatomic,retain) KATRadioButtonItem *selectedItem;

///项目数组
@property(nonatomic,retain) KATArray<__kindof KATRadioButtonItem *> *items;

///标签控件数组
@property(nonatomic,retain) KATArray<__kindof UILabel *> *labels;

///按钮数组
@property(nonatomic,retain) KATArray<__kindof KATButton *> *buttons;

///背景容器数组
@property(nonatomic,retain) KATArray<__kindof UIView *> *views;

///颜色
@property(nonatomic,retain) UIColor *color;

///高亮颜色(点击时)
@property(nonatomic,retain) UIColor *lightColor;

///圆角半径
@property(nonatomic,assign) float cornerRadius;

///线宽
@property(nonatomic,assign) float lineWidth;

///标签字体
@property(nonatomic,retain) UIFont *labelFont;

///按钮线宽
@property(nonatomic,assign) float buttonLineWidth;

///按钮高度
@property(nonatomic,assign) float buttonHeight;

///事件代理
@property(nonatomic,assign) id<KATRadioButtonDelegate> eventDelegate;


#pragma -mark 类方法

///获取实例
+ (instancetype)buttonWithFrame:(CGRect)frame;


#pragma -mark 对象方法

///加载项目
- (void)loadItems:(KATArray<__kindof KATRadioButtonItem *> *)items;

///更换颜色
- (void)changeColor:(UIColor *)color;

///通过索引更换选中标签
- (void)changeSelectedIndex:(int)index;

///通过item更换选中标签
- (void)changeSelectedItem:(KATRadioButtonItem *)item;

///释放内存
- (void)dealloc;


@end




